package com.gwtrpc.testapp.client;

import com.gwtrpc.testapp.client.GWT_RPC;

//import com.smartgwt.client.docs.Image;
import com.smartgwt.client.types.Alignment;
//import com.smartgwt.client.types.Cursor;
import com.smartgwt.client.types.DragAppearance;
import com.smartgwt.client.util.EventHandler;
//import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
/*
import com.smartgwt.client.widgets.events.DragMoveEvent;
import com.smartgwt.client.widgets.events.DragMoveHandler;
import com.smartgwt.client.widgets.events.DragStartEvent;
import com.smartgwt.client.widgets.events.DragStartHandler;
import com.smartgwt.client.widgets.events.DragStopEvent;
import com.smartgwt.client.widgets.events.DragStopHandler;
import com.smartgwt.client.widgets.events.DropEvent;
import com.smartgwt.client.widgets.events.DropHandler;
import com.smartgwt.client.widgets.events.ShowContextMenuEvent;
import com.smartgwt.client.widgets.events.ShowContextMenuHandler;
*/
class DragPiece extends Img {  
	
      private int n;
	  public DragPiece(String src,final int n) { 
		  
		  this.n = n;
		  setSrc(src);
	      setWidth(100);  
	      setHeight(100);  
	      setLayoutAlign(Alignment.CENTER);  
	      //setCanDragReposition(true); 
	      setCanDrag(true);
	      setCanDrop(true); 
	      setLayoutAlign(Alignment.CENTER);  
	      setDragAppearance(DragAppearance.TARGET);
	     
	      addClickHandler(new ClickHandler(){
	    	  public void onClick(ClickEvent event) {
	  				
	        	  System.out.println("Click");      			      
	  			  System.out.println(n);
	  			  GWT_RPC.doIT(n);
				  GWT_RPC.MovieBar.addChild(new DroppedPiece(((Img) EventHandler.getDragTarget()).getSrc()));  
	  		  }  
	      });  
	  }    
  }  